package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.MallCustomerAddress;
import com.ruoyi.swimming.mapper.MallCustomerAddressMapper;
import com.ruoyi.swimming.service.IMallCustomerAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 快递地址Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class MallCustomerAddressServiceImpl extends ServiceImpl<MallCustomerAddressMapper, MallCustomerAddress> implements IMallCustomerAddressService
{
    @Autowired
    private MallCustomerAddressMapper mallCustomerAddressMapper;

    /**
     * 查询快递地址
     * 
     * @param id 快递地址ID
     * @return 快递地址
     */
    @Override
    public MallCustomerAddress selectMallCustomerAddressById(Long id)
    {
        return mallCustomerAddressMapper.selectMallCustomerAddressById(id);
    }

    /**
     * 查询快递地址列表
     * 
     * @param mallCustomerAddress 快递地址
     * @return 快递地址
     */
    @Override
    public List<MallCustomerAddress> selectMallCustomerAddressList(MallCustomerAddress mallCustomerAddress)
    {
        return mallCustomerAddressMapper.selectMallCustomerAddressList(mallCustomerAddress);
    }

    /**
     * 新增快递地址
     * 
     * @param mallCustomerAddress 快递地址
     * @return 结果
     */
    @Override
    public int insertMallCustomerAddress(MallCustomerAddress mallCustomerAddress)
    {
        mallCustomerAddress.setCreateTime(DateUtils.getNowDate());
        return mallCustomerAddressMapper.insert(mallCustomerAddress);
    }

    /**
     * 修改快递地址
     * 
     * @param mallCustomerAddress 快递地址
     * @return 结果
     */
    @Override
    public int updateMallCustomerAddress(MallCustomerAddress mallCustomerAddress)
    {
        mallCustomerAddress.setUpdateTime(DateUtils.getNowDate());
        return mallCustomerAddressMapper.updateById(mallCustomerAddress);
    }

    /**
     * 批量删除快递地址
     * 
     * @param ids 需要删除的快递地址ID
     * @return 结果
     */
    @Override
    public int deleteMallCustomerAddressByIds(Long[] ids)
    {
        return mallCustomerAddressMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除快递地址信息
     * 
     * @param id 快递地址ID
     * @return 结果
     */
    @Override
    public int deleteMallCustomerAddressById(Long id)
    {
        return mallCustomerAddressMapper.deleteById(id);
    }
}
